package com.ayuan.blog.spider;

import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xiaozhu on 16/6/28.
 */
public class BuildUtil {

    public static List<Build> getBuildList(List<String> nameList, List<String> priceList) {
        List<Build> buildList = new ArrayList<Build>();

        if (CollectionUtils.isNotEmpty(nameList) && CollectionUtils.isNotEmpty(priceList)) {
            int minSize = nameList.size() < priceList.size() ? nameList.size() : priceList.size();
            for (int i = 0; i < minSize; i++) {
                Build build = new Build();
                build.setName(nameList.get(i));
                build.setPrice(priceList.get(i));
                buildList.add(build);
            }
        }

        return buildList;
    }
}
